﻿public class StateMachineBase 
{
    public IState currentState;
    public IState lastState;
    /// <summary>
    /// 切换状态
    /// </summary>
    /// <param name="taragetState"></param>
    public void ChangeState(IState taragetState)
    {
       // this.Log("进入"+taragetState);
        if (taragetState != currentState)//排除相同状态的记录
        {
            lastState = currentState;
        }
        currentState?.OnExit();
        currentState = taragetState;
        currentState?.OnEnter();
    }
    public void UpdateState()
    {
        currentState?.OnUpdate();
    }
    public void AnimatorUpdateStage()
    {
        currentState?.OnAnimatorUpdate();
    }
    public void FixedUpdateState()
    {
        currentState?.OnFixedUpdate();
    }
    public void AnimationEnd()
    {
        currentState.OnAnimationEnd();
    }

}